<template>
  <div class="ProcessManagement">
    <!-- 音频组件 -->
    <audio controls ref="audio" class="aud" v-show="false">
      <source src="../../../../public/mp3/NO.mp3"/>
    </audio>
    <audio controls ref="audioT" class="aud" v-show="false">
      <source src="../../../../public/mp3/OK.mp3"/>
    </audio>
    <div class="cont">
      <div class="cont-left">
        <div class="BasicInformation">
          <div class="title">
            基本信息
          </div>
          <div class="info">
            <el-row :gutter="10">
              <el-col :span="12" v-if="false">
                <el-form-item label="工 单 I D ：" prop="fOrgCategory">
                  <el-input disabled v-model="workInfo.fMoId"/>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="工单编号：" prop="fOrgCategory">
                  <el-input disabled v-model="workInfo.fMocCode"/>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="产品编号：" prop="fOrgCategory">
                  <el-input disabled v-model="workInfo.fInvCode"/>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="预计产量：" prop="fOrgCategory">
                  <el-input disabled v-model="workInfo.fQty"/>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="产品品名：" prop="fOrgCategory">
                  <el-input disabled v-model="workInfo.fInvName"/>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="产品规格：" prop="fOrgCategory">
                  <el-input disabled v-model="workInfo.fInvStd"/>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="规格描述：" prop="fOrgCategory">
                  <el-input disabled v-model="workInfo.fInvRemark"/>
                </el-form-item>
              </el-col>
              <hr style="width: 100%;margin-bottom: 1rem;">
              <el-col :span="20">
                <el-form-item label="产品条码：" prop="fOrgCategory">
                  <el-input disabled v-model="barCode"/>
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-button type="danger" @click="clearItem(2)">清空</el-button>
              </el-col>
              <el-col :span="12">
                <el-form-item label=" 操 作 员 ：">
                  <el-input disabled v-model="operatePer.code"/>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item>
                  <el-input disabled v-model="operatePer.name"/>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="报工工序：">
                  <el-input disabled v-model="proInfo.code"/>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item>
                  <el-input disabled v-model="proInfo.name"/>
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-button type="danger" @click="clearItem(0)">清空</el-button>
              </el-col>
              <el-col :span='4'>
                <el-button type="danger" @click="clearItem(1)">清空</el-button>
              </el-col>
            </el-row>
          </div>
        </div>
        <div class="ApplicationForWork">
          <div class="title">
            当日报工情况
          </div>
          <div class="info">
            <el-row :gutter="10">
              <el-col :span="24">
                <el-form-item label="日期：" prop="fOrgCategory">
                  <el-date-picker
                      type="date"
                      v-model="from.nowBGinf.now"
                  />
                </el-form-item>
              </el-col>
              <el-col :span="12">
                工序
              </el-col>
              <el-col :span="12">
                扫描台数
              </el-col>
              <el-col :span="12">
                <el-form-item prop="fOrgCategory">
                  <el-input disabled v-model="from.nowBGinf.scanPro"/>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item prop="fOrgCategory">
                  <el-input disabled v-model="from.nowBGinf.proScan.scanNum"/>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                完工台数
              </el-col>
              <el-col :span="12">
                扫描物料
              </el-col>
              <el-col :span="12">
                <el-form-item prop="fOrgCategory">
                  <el-input disabled v-model="from.nowBGinf.proScan.scanCompleteNum"/>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item prop="fOrgCategory">
                  <el-input disabled v-model="from.nowBGinf.proScan.scanInvNum"/>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                操作员
              </el-col>
              <el-col :span="12">
                扫描台数
              </el-col>
              <el-col :span="12">
                <el-form-item prop="fOrgCategory">
                  <el-input disabled v-model="from.nowBGinf.operator"/>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item prop="fOrgCategory">
                  <el-input disabled v-model="from.nowBGinf.operateScan.scanNum"/>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                完工台数
              </el-col>
              <el-col :span="12">
                扫描物料
              </el-col>
              <el-col :span="12">
                <el-form-item prop="fOrgCategory">
                  <el-input disabled v-model="from.nowBGinf.operateScan.scanCompleteNum"/>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item prop="fOrgCategory">
                  <el-input disabled v-model="from.nowBGinf.operateScan.scanInvNum"/>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="工作站：" prop="fOrgCategory">
                  <el-input disabled/>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-button type="danger" @click="clearAllConfirm" plain>初始化数据</el-button>
              </el-col>
            </el-row>
            <div class="listShow" v-if="publicData.listShow.list.length>0">
              <el-tooltip
                  class="box-item"
                  effect="light"
                  :content="publicData.listShow.head"
                  placement="top-start"
              >
                <div class="top">{{ publicData.listShow.head }}</div>
              </el-tooltip>
              <div class="bot">
                <ul>
                  <el-tooltip v-for="(i,j) in publicData.listShow.list"
                              class="box-item"
                              effect="dark"
                              :content="i"
                              placement="top-start"
                  >
                    <li>{{ j + 1 }}、{{ i }}</li>
                  </el-tooltip>
                </ul>
              </div>
            </div>
          </div>
        </div>
        <div class="ScanningItems">
          <div class="title">
            扫描品号
          </div>
          <div class="info">
            <el-row :gutter="10">
              <el-col :span="24">
                <el-table :data="tableData.SM" border style="width: 100%">
                  <el-table-column :show-overflow-tooltip="true" prop="fInvBarCode" label="物料条码"/>
                  <el-table-column :show-overflow-tooltip="true" prop="fBarCode" label="物料编号"/>
                  <el-table-column :show-overflow-tooltip="true" prop="fInvCode" label="品号"/>
                  <el-table-column :show-overflow-tooltip="true" prop="fMakeTime" label="制作时间"/>
                  <el-table-column :show-overflow-tooltip="true" prop="fScaPro" label="工序编号"/>
                  <el-table-column fixed="right" align="center" label="操作" width="100">
                    <template #default="scope">
                      <el-button type="danger" @click="delSM(scope)">
                        删除
                      </el-button>
                    </template>
                  </el-table-column>
                </el-table>
              </el-col>
            </el-row>
          </div>
        </div>
      </div>
      <div class="cont-rit">
        <div class="ScanningInf">
          <div class="title">
            扫描信息
          </div>
          <div class="info">
            <el-row :gutter="10">
              <el-col :span="24">
                <el-form-item>
                  <el-input :class="(SMinfShow.type!=-1)?'textarsu':'textar'" type="textarea" disabled
                            :placeholder="SMinfShow.text"/>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="扫描信息：" prop="fOrgName">
                  <el-input
                      ref="inputRef"
                      :autofocus="true" type="text" v-model.trim="from.smNum"
                      @keyup.enter="cx"
                      @click="selectInput"
                  />
                </el-form-item>
              </el-col>
            </el-row>
          </div>
        </div>
        <div class="Progress">
          <div class="title">
            <div class="text">
              物料扫描
            </div>
            <div class="fun">
              <img src="../../../assets/img/sc.png" alt="">
              <img src="../../../assets/img/sc.png" alt="">
            </div>
          </div>
          <div class="info">
            <el-row :gutter="10">
              <el-col :span="24">
                <div class="table-head-botton">
                  <button @click="publicData.pageTab=0">明细</button>
                  <button @click="publicData.pageTab=1">历史报工</button>
                </div>
                <el-table :data="tableData.JG" border style="width: 100%" v-show="publicData.pageTab==0">
                  <el-table-column align="center" :show-overflow-tooltip="true" prop="fSort" label="序号"/>
                  <el-table-column align="center" :show-overflow-tooltip="true" prop="fRequireQty" label="需扫描数"/>
                  <el-table-column align="center" :show-overflow-tooltip="true" prop="fAlreadyQty" label="已扫描数"/>
                  <el-table-column width="200" align="center" :show-overflow-tooltip="true" prop="fInvName"
                                   label="存货名称"/>
                  <el-table-column align="center" width="180" :show-overflow-tooltip="true" prop="fInvStd"
                                   label="规格型号"/>
                  <!-- <el-table-column align="center" :show-overflow-tooltip="true" prop="fProName" label="工序名称" /> -->
                  <!-- <el-table-column align="center" :show-overflow-tooltip="true" prop="fScaPro" label="工序编号" /> -->
                  <el-table-column align="center" :show-overflow-tooltip="true" prop="fBarCode" label="产品条码"/>
                  <el-table-column align="center" :show-overflow-tooltip="true" prop="fInvCode" label="存货编码"/>
                  <el-table-column fixed="right" align="center" label="操作" width="120">
                    <template #default="scope">
                      <el-button :type="(scope.$index===publicData.nowSm)?'primary':''"
                                 @click="select(scope.row,scope.$index)">
                        选择
                      </el-button>
                    </template>
                  </el-table-column>
                </el-table>
                <div class="hisList" v-show="publicData.pageTab==1">
                  <div class="ti">最近3条报工记录</div>
                  <div class="lists">
                    <div class="li" v-for="(i,j) in publicData.listShow.list">
                      <span>【{{ j + 1 }}】</span>{{ i }}
                    </div>
                  </div>
                </div>
              </el-col>
            </el-row>
          </div>
        </div>
      </div>
    </div>
  </div>
  <div class="footName"></div>
</template>

<script setup>
import {debounce} from "../../../utils/index.js";
import {onMounted, getCurrentInstance, ref, reactive, watch, nextTick} from 'vue';
import ajax from '../../../../public/JavaScript/api/ajax.js'
import {ElMessage, ElMessageBox} from 'element-plus';

let tableData = reactive({
  SM: [],
  JG: []
})
const publicData = reactive({
  nowSm: 0,
  nowData: {},
  isB: false,
  listShow: {
    head: '',
    list: []
  },
  pageTab: 0
})
const from = reactive({
  JBinfT: {
    fInvCode: '',
    fInvName: '',
    fInvRemark: '',
    fInvStd: '',
    fMoDId: '',
    fMoId: '',
    fMocCode: '',
    fProRemark: "",
    fQty: '',
    fcbSysBarCode: '',
    num: ''
  },
  JBinfB: {
    barCode: '',
    invCode: '',
    scan: '',
    userCode: '',
    userName: '',
    wpCode: '',
    wpName: ''
  },
  nowBGinf: {
    "now": new Date(),
    "operateScan": {
      "scanCompleteNum": 0,
      "scanInvNum": 0,
      "scanNum": 0
    },
    "operator": "",
    "proScan": {
      "scanCompleteNum": 0,
      "scanInvNum": 0,
      "scanNum": 0
    },
    "scanPro": ""
  },
  smNum: '',
  hisSm: ''
})
const SMinfShow = reactive({
  type: 0,
  text: '我是今日报工示例文字……',
  hisReport: '暂无信息……'
})
const inputRef = ref(null);
const scan = ref();
const barCode = ref();
// 工单信息
const workInfo = ref({});
// 操作人员
const operatePer = ref({
  code: '',
  name: '',
});
// 工序信息
const proInfo = ref({
  code: '',
  name: '',
});
// 判断上一个报工
const reportStatus = ref({
  code: "",
  msg: "",
});
// 上一个工序
const flag = ref(true);
const inputProInfo = ref([]);

// 扫描信息回车
const cx = () => {
  // 扫描基本信息
  ajax.post("/mrpc/sinfo", {
    body: {
      barCode: barCode.value,
      invCode: "",
      invFid: "",
      scan: from.smNum,
      userCode: operatePer.value.code,
      userName: operatePer.value.name,
      wpCode: proInfo.value.code,
      wpName: proInfo.value.name,
    },
  }, res => {
    scan.value = from.smNum;
    from.smNum = "";
    // 判断报工
    if (scan.value === "00" || scan.value === "01") {
      if (proInfo.value.code || operatePer.value.code) {
        // 报工
        report();
      }
    }
    // 扫描物料信息
    const query = {
      barCode: barCode.value,
      invCode: "",
      invFid: "",
      scan: scan.value,
      userCode: operatePer.value.code,
      userName: operatePer.value.name,
      wpCode: proInfo.value.code,
      wpName: proInfo.value.name,
    };
    if (tableData.JG.length > 0 && scan.value !== "00" && scan.value !== "01") {
      getInvScan(query, publicData.nowData);
    }
    if (res.data.scanCode === -1) {
      // 扫描失败
      // ElMessage.warning(res.data.scanMsg);
      SMinfShow.text = res.data.scanMsg;
      SMinfShow.type = -1;
      if (res.data.scanMsg === "该产品对应的工序已报工！") {
        reportStatus.value.code = scan.value;
        reportStatus.value.msg = "该产品对应的工序已报工！";
        changeProInfo();
      }
      return;
    }
    if (res.data.scanCode === 1) {
      // 工单扫描成功
      // ElMessage.success(res.data.scanMsg);
      SMinfShow.text = res.data.scanMsg;
      SMinfShow.type = 0;
      barCode.value = res.data.data.barCode
      workInfo.value = res.data.data.mocoRdersDisplayVo;
    } else if (res.data.scanCode === 2) {
      // 工序扫描成功
      // ElMessage.success(res.data.scanMsg);
      SMinfShow.text = res.data.scanMsg;
      SMinfShow.type = 0;
      proInfo.value = res.data.data;
      changeProInfo(proInfo.value);
    } else if (res.data.scanCode === 3) {
      // 操作员扫描成功
      operatePer.value = res.data.data;
    }
    getRecord();
    // 扫描信息 - 三个都不为空
    if (flag.value) {
      getScanInfo();
    }
  });
};
// 工序变化
const changeProInfo = (data) => {
  // if (reportStatus.value.msg === "该产品对应的工序已报工！") return;
  if (inputProInfo.value.length === 2) {
    inputProInfo.value.splice(0, 1);
  }
  inputProInfo.value.push(data);
  if (inputProInfo.value.length === 2) {
    if (reportStatus.value.code === inputProInfo.value[0].code) {
      console.log("上一个报工了");
    } else {
      if (inputProInfo.value[0].code === inputProInfo.value[1].code) {
        console.log("重复数据");
        return;
      }
      console.log("没有报工");
      ElMessageBox.confirm(`该工序${inputProInfo.value[0].code}在条码：${barCode.value}中未报工，是否强制报工？`, "Warning", {
        confirmButtonText: '报工',
        cancelButtonText: '取消',
        type: '提示',
      }).then(() => {
        console.log("强制");
        confirmReport(inputProInfo.value[0].code, inputProInfo.value[0].name);
      }).catch(() => {
        ElMessage({
          type: 'info',
          message: '取消报工',
        });
        flag.value = true;
      });
    }
  }
  // console.log(reportStatus.value.code);
  // if (inputProInfo.value.length >= 1) {
  //   if (reportStatus.value.code === inputProInfo.value[inputProInfo.value.length - 1]) {
  //     console.log("已经报工");
  //   }
  // }
};
// watch(proInfo, (newValue, oldValue) => {
//   if (!oldValue) {
//     console.log("第一次输入工序");
//   } else {
//     lastProInfo.value.code = oldValue.code;
//     if (lastProInfo.value.code === reportStatus.value.code) {
//       flag.value = true;
//     } else {
//       flag.value = false;
//       if (lastProInfo.value.code === proInfo.value.code) {
//
//       } else {
//         ElMessageBox.confirm(`改工序${oldValue.code}在条码：${barCode.value}中未报工，是否强制报工？`, "Warning", {
//           confirmButtonText: '报工',
//           cancelButtonText: '取消',
//           type: '提示',
//         }).then(() => {
//           console.log("强制");
//           confirmReport(oldValue.code, oldValue.name);
//         }).catch(() => {
//           ElMessage({
//             type: 'info',
//             message: '取消报工',
//           });
//           flag.value = true;
//         });
//       }
//     }
//   }
// }, {
//   deep: true,
//   immediate: true,
// });
// watch(proInfo, (newValue, oldValue) => {
//   if (proInfo.value.code !== "" && barCode.value !== "") {
//     if (oldValue.code === reportStatus.value.code) {
//       if (reportStatus.value.msg === "报工成功！") {
//         // 上一个已经报工
//         console.log("上一个已经报工");
//       }
//     } else {
//     }
//     // report();
//   }
// }, {
//   deep: true,
//   immediate: true,
// })
// 报工
const report = () => {
  const data = {
    barCode: barCode.value,
    invCode: "",
    invFid: "",
    scan: scan.value,
    userCode: operatePer.value.code,
    userName: operatePer.value.name,
    wpCode: proInfo.value.code,
    wpName: proInfo.value.name,
  };
  ajax.post("/mrpc/submit", {body: data}, res => {
    if (res.code === 200) {
      if (res.data.scanCode === -1) {
        // ElMessage.error(res.data.scanMsg);
        SMinfShow.text = res.data.scanMsg;
        SMinfShow.type = -1;
      } else if (res.data.scanCode === 0) {
        // ElMessage.success(res.data.scanMsg);
        SMinfShow.text = res.data.scanMsg;
        SMinfShow.type = 0;
        // 报工成功后，存入临时位置
        reportStatus.value.code = data.wpCode;
        reportStatus.value.msg = res.data.scanMsg;
      }
    }
  });
};
// 确认报工
const confirmReport = (code, name) => {
  const data = {
    barCode: barCode.value,
    invCode: "",
    invFid: "",
    scan: "01",
    userCode: operatePer.value.code,
    userName: operatePer.value.name,
    wpCode: code,
    wpName: name,
  };
  ajax.post("/mrpc/sureSubmit", {body: data}, res => {
    if (res.code === 200) {
      if (res.data.scanCode === -1) {
        // ElMessage.error(res.data.scanMsg);
        SMinfShow.text = res.data.scanMsg;
        SMinfShow.type = -1;
      } else if (res.data.scanCode === 0) {
        // ElMessage.success(res.data.scanMsg);
        SMinfShow.text = res.data.scanMsg;
        SMinfShow.type = 0;
        reportStatus.value.code = data.wpCode;
        reportStatus.value.msg = res.data.scanMsg;
      }
    }
  });
};
// 查询当日报工情况
const getTotal = (data) => {
  ajax.post("/mrpc/stotal", {body: data}, res => {
    if (res.code === 200) {
      from.nowBGinf.now = res.data.now;
      if (res.data.proScan) {
        // 工序
        from.nowBGinf.scanPro = res.data.scanPro;
        from.nowBGinf.proScan.scanNum = res.data.proScan.scanNum;
        from.nowBGinf.proScan.scanCompleteNum = res.data.proScan.scanCompleteNum;
        from.nowBGinf.proScan.scanInvNum = res.data.proScan.scanInvNum;
      }
      if (res.data.operateScan) {
        // 操作人
        from.nowBGinf.operator = res.data.operator;
        from.nowBGinf.operateScan.scanNum = res.data.operateScan.scanNum;
        from.nowBGinf.operateScan.scanCompleteNum = res.data.operateScan.scanCompleteNum;
        from.nowBGinf.operateScan.scanInvNum = res.data.operateScan.scanInvNum;
      }
    }
  }, err => {
    ElMessage.error(err);
  });
};
// 当日报工情况
const getRecord = () => {
  if (proInfo.value.code || operatePer.value.code) {
    const data = {
      barCode: "",
      invCode: "",
      invFid: "",
      scan: from.smNum,
      userCode: operatePer.value.code,
      userName: operatePer.value.name,
      wpCode: proInfo.value.code,
      wpName: proInfo.value.name,
    };
    // 查询3天记录
    ajax.post("/mrpc/slt", {
      body: data
    }, res => {
      if (res.code === 200) {
        publicData.listShow.head = res.data.head;
        publicData.listShow.list = res.data.body;
      }
    });
    // 查询当日报工情况
    getTotal(data);
  }
};
// 扫描信息
const getScanInfo = () => {
  if (barCode.value && proInfo.value.code && operatePer.value.code) {
    const data = {
      barCode: barCode.value,
      invCode: "",
      invFid: "",
      scan: scan.value,
      userCode: operatePer.value.code,
      userName: operatePer.value.name,
      wpCode: proInfo.value.code,
      wpName: proInfo.value.name,
    };
    ajax.post("/mrpc/spro", {body: data}, res => {
      if (res.code === 200) {
        tableData.SM = res.data.alreadyList; // 已扫描
        tableData.JG = res.data.withoutVoList; // 未扫描
        publicData.nowData = res.data.withoutVoList[0];
        // if (res.data.withoutVoList.length > 0) {
        //   getInvScan(data, publicData.nowData);
        // }
      } else {
        // ElMessage.error(res.msg);
        SMinfShow.text = res.msg;
        SMinfShow.type = -1;
      }
    });
  }
};
const selectInput = () => {
  inputRef.value.select();
};
// 扫描物料信息
const getInvScan = (data, public_data) => {
  data.barCode = public_data.fBarCode;
  data.invCode = public_data.fInvCode;
  data.invFid = public_data.fId;
  // data.scan = public_data.fBarCode;
  // 扫描物料信息
  ajax.post("/mrpc/sinv", {body: data}, res => {
    if (res.code === 200) {
      if (res.data.scanCode === -1) {
        // ElMessage.error(res.data.scanMsg);
        SMinfShow.text = res.data.scanMsg;
        SMinfShow.type = -1;
      } else if (res.data.scanCode === 0) {
        // ElMessage.success(res.data.scanMsg);
        SMinfShow.text = res.data.scanMsg;
        SMinfShow.type = 0;
        tableData.SM = res.data.data.alreadyList;
        tableData.JG = res.data.data.withoutVoList;
        publicData.nowSm = 0;
        publicData.nowData = res.data.data?.withoutVoList[0] || {};
        getTotal(data);
        getScanInfo();
      }
    } else {
      // ElMessage.error(res.msg);
      SMinfShow.text = res.msg;
      SMinfShow.type = -1;
    }
  });
};
// 撤销物料信息
const delSM = (scope) => {
  const data = {
    barCode: scope.row.fBarCode,
    invCode: scope.row.fInvCode,
    invFid: scope.row.fId,
    scan: scope.row.fInvBarCode,
    userCode: operatePer.value.code,
    userName: operatePer.value.name,
    wpCode: proInfo.value.code,
    wpName: proInfo.value.name,
  };
  ElMessageBox.confirm("是否对该产品进行删除？", "警告", {
    confirmButtonText: '是',
    cancelButtonText: '否',
    type: 'error',
  }).then(() => {
    ajax.post("/mrpc/dinv", {body: data}, res => {
      if (res.code === 200) {
        if (res.data.scanCode === 0) {
          // ElMessage.success('删除成功');
          SMinfShow.text = "删除成功";
          SMinfShow.type = 0;
          tableData.SM = res.data.data.alreadyList;
          tableData.JG = res.data.data.withoutVoList;
          publicData.nowSm = 0;
          publicData.nowData = res.data.data.withoutVoList[0];
          getTotal(data);
        }
      } else {
        // ElMessage.error(res.msg);
        SMinfShow.text = res.msg;
        SMinfShow.type = 0;
      }
    })
  });
};
/* 清除部分扫描信息 */
const clearItem = (type) => {
  console.log(type)
  switch (type) {
    case 0:
      // 0 - 工序
      proInfo.value = {code: '', name: ''};
      break;
    case 1:
      // 1 - 全部
      workInfo.value = {};
      operatePer.value = {code: '', name: ''};
      proInfo.value = {code: '', name: ''};
      barCode.value = "";
      break;
    case 2:
      // 2 - 条码
      barCode.value = "";
  }
};

// 物流扫描选择
const select = (data, index) => {
  publicData.nowSm = 0
  publicData.nowData = data;
  const query = {
    barCode: barCode.value,
    invCode: "",
    invFid: "",
    scan: scan.value,
    userCode: operatePer.value.code,
    userName: operatePer.value.name,
    wpCode: proInfo.value.code,
    wpName: proInfo.value.name,
  };
  let tem_arr = tableData.JG;
  const obj = tem_arr[index];
  tem_arr.splice(index, 1);
  tem_arr.unshift(obj);
  tableData.JG = tem_arr;
  // getInvScan(query, publicData.nowData);
};
</script>

<style lang="less" scoped>
@import url("./ProcessManagement.less");
</style>